#ifndef __BLENDMODE_H__
#define __BLENDMODE_H__

#include "ColourValue.h"

namespace PVM
{
	enum LayerBlendType
	{
		LBT_COLOUR,
		LBT_ALPHA
	};
	
	enum LayerBlendOperation
	{
		LBO_REPLACE,
		LBO_ADD,
		LBO_MODULATE,
		LBO_ALPHA_BLEND,
	};
	
	enum LayerBlendOperationEx
	{
		LBX_SOURCE1,
		LBX_SOURCE2,
		LBX_MODULATE,
		LBX_MODULATE_X2,
		LBX_MODULATE_X4,
		LBX_ADD,
		LBX_ADD_SIGNED,
		LBX_ADD_SMOOTH,
		LBX_SUBTRACT,
		LBX_BLEND_DIFFUSE_ALPHA,
		LBX_BLEND_TEXTURE_ALPHA,
		LBX_BLEND_CURRENT_ALPHA,
		LBX_BLEND_MANUAL,
		LBX_DOTPRODUCT,
		LBX_BLEND_DIFFUSE_COLOUR
	};
	
	enum LayerBlendSource
	{
		LBS_CURRENT,
		LBS_TEXTURE,
		LBS_DIFFUSE,
		LBS_SPECULAR,
		LBS_MANUAL
	};
	
	class LayerBlendModeEx
	{
	pubic:
		LayerBlendType blendType;
		LayerBlendOperationEx operation;
		LayerBlendSource source1;
		LayerBlendSource source2;
		
		ColourValue colourArg1;
		ColourValue colourArg2;
		Real alphaArg1;
		Real alphaArg2;
		Real factor;
		
		bool operator==(const LayerBlendModeEx& rhs) const
		{
			if (blendType != rhs.blendType) return false;
			
			if (blendType == LBT_COLOUR)
			{
				if (operation == rhs.operation &&
					source1 == rhs.source1 &&
					source2 == rhs.source2 &&
					colourArg1 == rhs.colourArg1 &&
					colourArg2 == rhs.colourArg2 &&
					factor == rhs.factor)
				{
					return true;
				}
			}
			else 
			{
				if (operation == rhs.operation &&
					source1 == rhs.source1 &&
					source2 == rhs.source2 &&
					alphaArg1 == rhs.alphaArg1 &&
					alphaArg2 == rhs.alphaArg2 &&
					factor == rhs.factor)
				{
					return true;
				}
			}
			return false;
		}
		
		bool operator!=(const LayerBlendModeEx& rhs) const
		{
			return !(*this == rhs);
		}
	};
	
	enum SceneBlendType
	{
		SBT_TRANSPARENT_ALPHA,
		SBT_TRANSPARENT_COLOUR,
		SBT_ADD,
		SBT_MODULATE,
		SBT_REPLACE
	};
	
	enum SceneBlendFactor
	{
		SBF_ONE,
		SBF_ZERO,
		SBF_DEST_COLOUR,
		SBF_SOURCE_COLOUR,
		SBF_ONE_MINUS_DEST_COLOUR,
		SBF_ONE_MINUS_SOURCE_COLOUR,
		SBF_DEST_ALPHA,
		SBF_SOURCE_ALPHA,
		SBF_ONE_MINUS_DEST_ALPHA,
		SBF_ONE_MINUS_SOURCE_ALPHA
	};
	
	enum SceneBlendOperation
	{
		SBO_ADD,
		SBO_SUBTRACT,
		SBO_REVERSE_SUBTRACT,
		SBO_MIN,
		SBO_MAX
	};
}

#endif
